package form;

import java.awt.FlowLayout;
import connection.ConnectionManager;
import connection.HostManager;

public class SureDialog extends javax.swing.JDialog {

    //public RequestDrawDialog(java.awt.Frame parent, boolean modal) {
    public SureDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        setSize(150, 64);
        setTitle("Are you Sure?");
        setLayout(new FlowLayout());
        initComponents();
        mainFrame = (MainFrame) parent;
        //SureDialog.connMan = connMan;
        //SureDialog.hostMan = hostMan;
    }

    private void initComponents() {
        yesButton = new javax.swing.JButton();
        noButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        yesButton.setMnemonic('Y');
        yesButton.setText("Yes");
        yesButton.setName("yesButton"); 
        yesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                yesButtonActionPerformed(evt);
            }
        });
        add(yesButton);
        noButton.setMnemonic('N');
        noButton.setText("No");
        noButton.setName("noButton");
        noButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noButtonActionPerformed(evt);
            }
        });
        add(noButton);
    }
        	
    private void yesButtonActionPerformed(java.awt.event.ActionEvent evt) {
    	dispose();
    	mainFrame.resign();
    }

    private void noButtonActionPerformed(java.awt.event.ActionEvent evt) {
    	//do something?
    	dispose();
    }

    
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                SureDialog dialog = new SureDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
	private javax.swing.JButton yesButton;
    private javax.swing.JButton noButton;
    private static HostManager hostMan;
    private MainFrame mainFrame;
    private static ConnectionManager connMan;
}
